if(!jsx3.lang.Class.forName("ux.cdb.admin.approvePkg.provPkgWizard.ProvRcpPkgChooser")) {
	jsx3.lang.Class.defineClass("ux.cdb.admin.approvePkg.provPkgWizard.ProvRcpPkgChooser",
			ux.megatron.gui.WizardPanel,
			null,
			function (block) {
				/**
				 * instance initializer
				 * @param strName {String} unique name distinguishing this object from all other JSX GUI objects in the JSX application
				 * @param vntLeft {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
				 * @param vntTop {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
				 * @param vntWidth {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
				 * @param vntHeight {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
				 * @param strHTML {String} Text/HTML markup to place in the jsx3.gui.Block instance
				 */
				block.prototype.init = function(strName, vntLeft, vntTop, vntWidth, vntHeight, strHTML) {
					//call constructor for super class (the super expects the name of the object and the function that it is an instance of)
					this.jsxsuper(strName, vntLeft, vntTop, vntWidth, vntHeight, strHTML);
				};

				block.prototype.initialize = function() {
					this.txtPartyID = null;
					this.txtBatchApprovalInfoId = null;
					this.mtxRcpPkgList = this.get("mtxRcpPkgList");
					this.wizard = this.getAncestorOfType("ux.megatron.gui.SteppedWizard");
					this.wizardDlg = this.getAncestorOfType("ux.cdb.admin.approvePkg.provPkgWizard.Builder");
					this.curPage = ux.megatron.Main.getServer().getDynamicProperty("@cdb@apvPkg@curPage");
					this.pageSize = ux.megatron.Main.getServer().getDynamicProperty("@cdb@apvPkg@pageNum");
					this.pagebar = this.get("blkPageWheel");
					this.pagebar.initialize();
					this.pagebar.bindWithMatrix(this, this.loadPagination, this.mtxRcpPkgList);

					var me = this;
					this.mtxRcpPkgList.subscribe(ux.cdb.admin.gui.Matrix.EVENT_CHECKALL,me,me.isSaved);
					//not load data from server automatic
					//this.loadProvRcpPkgData();
				}

				block.prototype.loadPagination = function(msg) {
					this.curPage = (msg && msg.currentPageNumber) ? msg.currentPageNumber : (this.curPage || 1);
					this.loadProvRcpPkgData();
				};

				block.prototype.onQueryClick = function() {
					this.txtBatchApprovalInfoId = this.wizardDlg.get("txtBatchApprovalInfoId").getValue();
					this.txtPartyID = this.wizardDlg.get("txtPartyID").getValue();
					this.loadProvRcpPkgData();
				};

				block.prototype.loadProvRcpPkgData = function(){
					var me = this;
					ux.megatron.util.Dwr.callDwr("RetailStudentLoanBatchExamUCC",
							"getBatchApprovalInfoList",[this.txtBatchApprovalInfoId,this.txtPartyID,this.curPage,this.pageSize],
							me,me.callBackGetBatchApprovalInfoList,
							"RetailStudentLoanBatchExamUCC");
				}

				block.prototype.callBackGetBatchApprovalInfoList = function(dwrObjectList){
					if(!dwrObjectList){
						jsx3.log("DWR callBackProvRcpPkgData failed");
						return;
					}
					this.totalRecordCount = dwrObjectList.content.page.count;
					this.totalPages = (this.totalRecordCount % this.pageSize > 0) ? (parseInt(this.totalRecordCount / this.pageSize) + 1) : (this.totalRecordCount / this.pageSize);
					if (this.totalPages == 0) this.totalPages = 1;
					this.pagebar.setValue(this.curPage,this.totalPages,this.pageSize,this.totalRecordCount); 

					var cdfDoc = ux.megatron.util.Dwr.toCdfDocument(dwrObjectList.content.data,"jsxroot",{"batchApprovalInfoId":"jsxid"}); 
					this.mtxRcpPkgList.setSourceXML(cdfDoc);
					this.mtxRcpPkgList.repaintData();
				}

				block.prototype.isSaved = function(){
					if(this.mtxRcpPkgList.getCheckedNodes().size() == 0){
						this.wizard.get("buttonSubmit").disable();
					}
					else{
						this.wizard.get("buttonSubmit").enable();
					}
				}

				block.prototype.onSubmit = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
					var ctrtIdsArray = new Array();
					matrixListNodes = this.mtxRcpPkgList.getCheckedNodes();
					for(var i = 0;i < matrixListNodes.size();i++){
						var recordObj = new Object();
						recordObj.batchApproveInfoId = matrixListNodes.get(i).getAttribute("jsxid");
						recordObj.virtualApproveObjectId = matrixListNodes.get(i).getAttribute("virtualApproveObjectId");
						ctrtIdsArray.push(recordObj);
					}
					var me = this;
					/* */
					ux.megatron.util.Dwr.callDwr("RetailStudentLoanBatchExamUCC",
							"gatherBranchBatch",[ctrtIdsArray],
							me,me.callBackGatherBranchBatch,
							"RetailStudentLoanBatchExamUCC"); 
					objBUTTON.disable();
					return 'NONE';
				}

				block.prototype.callBackGatherBranchBatch = function(dwrObject){
					if(dwrObject.res.flag == 1){
						this.closeDialog();
					}else{
						alert("error,submit failed");
					}
				}
				block.prototype.onCancel = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
					this.getAncestorOfType("ux.cdb.admin.approvePkg.provPkgWizard.Builder").onClose();
					return null; // return "NONE" to not advance panels
				}

				block.prototype.closeDialog = function() {
					this.wizardDlg.opener.onRefreshUI();
					this.wizardDlg.onClose();
				}
			}
	);
}
